package com.example.communitypro.controller;

import com.example.communitypro.pojo.Post;
import com.example.communitypro.pojo.UserSearchHistory;
import com.example.communitypro.service.UserSearchHistoryService;
import com.example.communitypro.util.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/userSearchHistory")
public class UserSearchHistoryController {

    @Autowired
    private UserSearchHistoryService userSearchHistoryService;

    @ResponseBody
    @RequestMapping(value = "/addUserSearchHistory")
    @CrossOrigin
    public Result addUserSearchHistory(UserSearchHistory userSearchHistory){
        return userSearchHistoryService.addUserSearchHistory(userSearchHistory);
    }

    @ResponseBody
    @RequestMapping(value = "/dropUserSearchHistory")
    @CrossOrigin
    public Result dropUserSearchHistory(Integer search_history_no){
        return userSearchHistoryService.dropUserSearchHistory(search_history_no);
    }

    @ResponseBody
    @RequestMapping(value = "/modifyUserSearchHistory")
    @CrossOrigin
    public Result modifyUserSearchHistory(UserSearchHistory userSearchHistory){
        return userSearchHistoryService.modifyUserSearchHistory(userSearchHistory);
    }

    @ResponseBody
    @RequestMapping(value = "/queryUserSearchHistory")
    @CrossOrigin
    public Result queryUserSearchHistory(Integer search_history_no){
        return userSearchHistoryService.queryUserSearchHistory(search_history_no);
    }

    @ResponseBody
    @RequestMapping(value = "/queryUserSearchHistoryServiceByUser")
    @CrossOrigin
    public Result queryUserSearchHistoryServiceByUser(Integer user_no){
        return userSearchHistoryService.queryUserSearchHistoryServiceByUser(user_no);
    }

    @ResponseBody
    @RequestMapping(value = "/dropUserSearchHistoryServiceByUser")
    @CrossOrigin
    public Result dropUserSearchHistoryServiceByUser(Integer user_no){
        return userSearchHistoryService.dropUserSearchHistoryServiceByUser(user_no);
    }
}
